<?php
/**
 * Spellbook: Web application framework
 *
 * @author       Jorge Pena <jmgpena@gmail.com>
 * @version 3.0
 * @package sbook
 */

/**
 * Controller 
 *
 * This class implements the controller in the MVC model used in spellbook
 * TODO Rest of documentation
 * 
 * @package sbook
 * @copyright 2004-2006 Wiz Interactive
 * @author Jorge Pena <jmgpena@gmail.com> 
 */
class Controller
{
    protected $view;

	function __construct(&$response)
	{
        $this->r = $response;
	}

	function DefaultAction($params) 
	{
	}

	function Initialize()
	{
        // runs at the beginning of every request
	}

	function Finalize()
	{
        // runs at the end of every request
	}

	function _redirect($url)
	{
		header('Location: '.BASEURI.$url);
		exit;
	}

    function _error_404()
    {
        $this->tpl->template_dir = CORETEMPLATES;
        $this->tpl->display('error_404.tpl');
        exit;
    }
}
?>
